//
//  MainSearchBottom.m
//  ZITHER
//
//  Created by weixin on 2018/11/19.
//  Copyright © 2018 weixn. All rights reserved.
//

#import "MainSearchBottom.h"

@implementation MainSearchBottom

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor colorWithHex:@"606060"];
        [self addSubview:self.btnCancel];
        [self addSubview:self.btnDone];
    }
    return self;
}

-(BaseBtn *)btnCancel{
    if (!_btnCancel) {
        _btnCancel = [[BaseBtn alloc]initializeFrame:CGRectMake(0, 0, kScreenW/2.0, 50) NormalImage:@"key_btn_cancel" SeleImage:@""];
        _btnCancel.backgroundColor = [UIColor clearColor];
        [_btnCancel setTitleColor:[UIColor colorWithHex:@"999999"] forState:UIControlStateNormal];
        [_btnCancel setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];
    }
    return _btnCancel;
}

-(BaseBtn *)btnDone{
    if (!_btnDone) {
        _btnDone = [[BaseBtn alloc]initializeFrame:CGRectMake(kScreenW/2.0, 0, kScreenW/2.0, 50) NormalImage:@"key_btn_search" SeleImage:@""];
        _btnDone.backgroundColor = [UIColor clearColor];
        [_btnDone setTitleColor:[UIColor colorWithHex:@"999999"] forState:UIControlStateNormal];
        [_btnDone setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];

    }
    return _btnDone;
}
-(void)setState:(State)state{
    switch (state) {
        case Title:
            [self.btnDone setTitle:@"确定" forState:UIControlStateNormal];
            [self.btnCancel setTitle:@"取消" forState:UIControlStateNormal];
            [self.btnDone setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
            [self.btnCancel setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
            self.backgroundColor = [UIColor whiteColor];
            break;
        case Image:
            [self.btnDone setTitle:@"" forState:UIControlStateNormal];
            [self.btnCancel setTitle:@"" forState:UIControlStateNormal];
            [self.btnDone setImage:[UIImage imageNamed:@"key_btn_search"] forState:UIControlStateNormal];
            [self.btnCancel setImage:[UIImage imageNamed:@"key_btn_cancel"] forState:UIControlStateNormal];
            self.backgroundColor = [UIColor colorWithHex:@"606060"];
            
            break;
        default:
            break;
    }

}



@end
